<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% String path = request.getContextPath();
    request.setAttribute("path",path);%>
<!DOCTYPE>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>客房预定</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${path}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${path}/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="${path}/css/plugins/dataTables/dataTables.bootstrap.css"
          rel="stylesheet">
    <link href="${path}/css/animate.css" rel="stylesheet">
    <link href="${path}/css/style.css?v=4.1.0" rel="stylesheet">

</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>预定客房</h5>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="commentForm" action="${path}/tbOrder/kf_order">
                        <input hidden name="kfId" value="${kfRoomById.id}">
                        <input hidden name="userId" value="${userinfo.id}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">订单号</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control"  id="orderNum" name="orderNum" value="${orderNum}" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">预定时间</label>
                            <div class="col-sm-7">
                                <input type="datetime-local" class="form-control" id="orderYdTime"  name="orderYdTime" minlength="6" required value="" onchange="yd_rz()">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">入住时间</label>
                            <div class="col-sm-7">
                                <input type="datetime-local" class="form-control" id="orderRzTime" name="orderRzTime" minlength="6" required value="" onchange="yd_rz()">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">入住天数</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control"  name="orderDay" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">支付金额</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control"  name="orderPayMoney" value="${kfRoomById.kfHdPrice}" readonly="readonly">
                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-8">
                                <button class="btn btn-success" type="submit">预定&nbsp;&nbsp;定</button>&nbsp;&nbsp;&nbsp;&nbsp;
                                <button class="btn btn-white" type="reset" >取&nbsp;&nbsp;消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="${path}/js/jquery.min.js?v=2.1.4"></script>
<script src="${path}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${path}/js/plugins/jeditable/jquery.jeditable.js"></script>

<!-- Data Tables -->
<script src="${path}/js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="${path}/js/plugins/dataTables/dataTables.bootstrap.js"></script>

<!-- 自定义js -->
<script src="${path}/js/content.js?v=1.0.0"></script>

<!-- 表单验证 -->
<script src="${path}/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${path}/js/plugins/validate/messages_zh.min.js"></script>

<!-- layer javascript -->
<script src="${path}/js/plugins/layer/layer.min.js"></script>
<script>
    $().ready(function() {
        $("#commentForm").validate();
    });
    $.validator.setDefaults({
        submitHandler: function() {
            parent.layer.alert('添加成功！',{icon: 1}),
                form.submit();
        }
    });

    function yd_rz(){
        var yd_value = $("#orderYdTime")[0].value;
        var rz_value = $("#orderRzTime")[0].value;
        if (yd_value!=""&&rz_value!=""){
            $.ajax({
                url:"/tbOrder/yd_rz",
                type:"post",
                data:{"yd_value":yd_value,"rz_value":rz_value},
                dataType:"text",
                success:function (data){
                    if (data=="1"){
                        $("#orderRzTime")[0].value="";
                        alert("请输入正确的入住时间")
                    }
                }
            })
        }
    }

    /*
    function username_is_repeat(){
        var username = $("#username").val();

        $.ajax({
            url:"/cuser/username_is_repeat",
            data:"username="+username,
            type:"post",
            dataType: "text",
            success:function (data){
                if (data=="0"){
                    document.getElementById("username_tsyj").hidden=true;
                }else {
                    document.getElementById("username_tsyj").hidden=false;
                }
            }
        })
    }*/

</script>
</body>
</html>
